﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common.EntityValidation
{
    public class NotNullAttribute : ValidationAttribute
    {
        public bool? NotNull { get; set; } = true;
        public NotNullAttribute()
        {
            ErrorMessage = "{0}是必填的";

        }
        public override bool Verify(object o)
        {

            if (o == null)
            {
                return false;
            }
            else if (string.IsNullOrWhiteSpace(o.ToString()))
            {
                return false;
            }

            return true;
        }
    }
}